From 921b3b8d716f9491df40a46fdc0ed5dde95380cb Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 31 Mar 2004 16:30:33 +0000 Subject: [PATCH] (dired-do-touch): New fun. (dired-do-chxxx): Add argument -t for touch operation. --- lisp/dired-aux.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 1fc8e0e805a..0709e0cfe1c 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -186,7 +186,7 @@ List has a form of (file-name full-file-name (attribute-list))" (directory-files dir))) (defun dired-do-chxxx (attribute-name program op-symbol arg) - ;; Change file attributes (mode, group, owner) of marked files and + ;; Change file attributes (mode, group, owner, timestamp) of marked files and ;; refresh their file lines. ;; ATTRIBUTE-NAME is a string describing the attribute to the user. ;; PROGRAM is the program used to change the attribute. @@ -203,7 +203,10 @@ List has a form of (file-name full-file-name (attribute-list))" (dired-bunch-files 10000 (function dired-check-process) (append - (list operation program new-attribute) + (list operation program) + (if (eq op-symbol 'touch) + '("-t") nil) + (list new-attribute) (if (string-match "gnu" system-configuration) '("--") nil)) files)) @@ -236,6 +239,12 @@ This calls chmod, thus symbolic modes like `g+w' are allowed." (error "chown not supported on this system")) (dired-do-chxxx "Owner" dired-chown-program 'chown arg)) +(defun dired-do-touch (&optional arg) + "Change the timestamp of the marked (or next ARG) files. +This calls touch." + (interactive "P") + (dired-do-chxxx "Timestamp" dired-touch-program 'touch arg)) + ;; Process all the files in FILES in batches of a convenient size, ;; by means of (FUNCALL FUNCTION ARGS... SOME-FILES...). ;; Batches are chosen to need less than MAX chars for the file names, -- 2.30.2